.class public Lcom/kuguo/ad/KuguoAdsManager;
.super Ljava/lang/Object;


# static fields
.field public static final STYLE_FREE:I = 0x1

.field public static final STYLE_SIDE:I

.field static cooId:Ljava/lang/String;

.field public static hasRequest:Z

.field private static listener:Ljava/util/Set;

.field private static manager:Lcom/kuguo/ad/KuguoAdsManager;


# instance fields
.field private handler:Landroid/os/Handler;

.field private kuguoFree:Lcom/kuguo/ad/s;

.field private kuguoSide:Lcom/kuguo/ad/s;

.field private mInstallPackageReceiver:Lcom/kuguo/ad/c;

.field private showKuguoFree:Z

.field private showKuguoSide:Z


# direct methods
.method static constructor <clinit>()V
    .locals 1

    const/4 v0, 0x0

    sput-object v0, Lcom/kuguo/ad/KuguoAdsManager;->cooId:Ljava/lang/String;

    const/4 v0, 0x0

    sput-boolean v0, Lcom/kuguo/ad/KuguoAdsManager;->hasRequest:Z

    new-instance v0, Ljava/util/HashSet;

    invoke-direct {v0}, Ljava/util/HashSet;-><init>()V

    sput-object v0, Lcom/kuguo/ad/KuguoAdsManager;->listener:Ljava/util/Set;

    return-void
.end method

.method private constructor <init>()V
    .locals 3

    const/4 v2, 0x0

    const/4 v1, 0x0

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    new-instance v0, Landroid/os/Handler;

    invoke-direct {v0}, Landroid/os/Handler;-><init>()V

    iput-object v0, p0, Lcom/kuguo/ad/KuguoAdsManager;->handler:Landroid/os/Handler;

    iput-object v2, p0, Lcom/kuguo/ad/KuguoAdsManager;->kuguoSide:Lcom/kuguo/ad/s;

    iput-object v2, p0, Lcom/kuguo/ad/KuguoAdsManager;->kuguoFree:Lcom/kuguo/ad/s;

    iput-boolean v1, p0, Lcom/kuguo/ad/KuguoAdsManager;->showKuguoSide:Z

    iput-boolean v1, p0, Lcom/kuguo/ad/KuguoAdsManager;->showKuguoFree:Z

    return-void
.end method

.method static synthetic access$000(Lcom/kuguo/ad/KuguoAdsManager;)Z
    .locals 1

    iget-boolean v0, p0, Lcom/kuguo/ad/KuguoAdsManager;->showKuguoSide:Z

    return v0
.end method

.method static synthetic access$102(Lcom/kuguo/ad/KuguoAdsManager;Lcom/kuguo/ad/s;)Lcom/kuguo/ad/s;
    .locals 0

    iput-object p1, p0, Lcom/kuguo/ad/KuguoAdsManager;->kuguoSide:Lcom/kuguo/ad/s;

    return-object p1
.end method

.method static synthetic access$200(Lcom/kuguo/ad/KuguoAdsManager;)Z
    .locals 1

    iget-boolean v0, p0, Lcom/kuguo/ad/KuguoAdsManager;->showKuguoFree:Z

    return v0
.end method

.method static synthetic access$302(Lcom/kuguo/ad/KuguoAdsManager;Lcom/kuguo/ad/s;)Lcom/kuguo/ad/s;
    .locals 0

    iput-object p1, p0, Lcom/kuguo/ad/KuguoAdsManager;->kuguoFree:Lcom/kuguo/ad/s;

    return-object p1
.end method

.method static synthetic access$400()Ljava/util/Set;
    .locals 1

    sget-object v0, Lcom/kuguo/ad/KuguoAdsManager;->listener:Ljava/util/Set;

    return-object v0
.end method

.method protected static addOnAppInstallListener(Lcom/kuguo/ad/al;)V
    .locals 1

    sget-object v0, Lcom/kuguo/ad/KuguoAdsManager;->listener:Ljava/util/Set;

    invoke-interface {v0, p0}, Ljava/util/Set;->add(Ljava/lang/Object;)Z

    return-void
.end method

.method public static getInstance()Lcom/kuguo/ad/KuguoAdsManager;
    .locals 1

    sget-object v0, Lcom/kuguo/ad/KuguoAdsManager;->manager:Lcom/kuguo/ad/KuguoAdsManager;

    if-nez v0, :cond_0

    new-instance v0, Lcom/kuguo/ad/KuguoAdsManager;

    invoke-direct {v0}, Lcom/kuguo/ad/KuguoAdsManager;-><init>()V

    sput-object v0, Lcom/kuguo/ad/KuguoAdsManager;->manager:Lcom/kuguo/ad/KuguoAdsManager;

    :cond_0
    sget-object v0, Lcom/kuguo/ad/KuguoAdsManager;->manager:Lcom/kuguo/ad/KuguoAdsManager;

    return-object v0
.end method

.method private requestAppList(Landroid/content/Context;)V
    .locals 2

    invoke-static {p1}, Lcom/kuguo/ad/a;->o(Landroid/content/Context;)Z

    move-result v0

    if-nez v0, :cond_1

    const-string v0, "android__log"

    const-string v1, "b has not request !! "

    invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    new-instance v0, Lcom/kuguo/ad/g;

    invoke-direct {v0, p1}, Lcom/kuguo/ad/g;-><init>(Landroid/content/Context;)V

    invoke-virtual {v0}, Lcom/kuguo/ad/g;->a()V

    :cond_0
    :goto_0
    const/4 v0, 0x1

    sput-boolean v0, Lcom/kuguo/ad/KuguoAdsManager;->hasRequest:Z

    return-void

    :cond_1
    const-string v0, "android__log"

    const-string v1, "b has request !! "

    invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    invoke-static {p1}, Lcom/kuguo/ad/a;->r(Landroid/content/Context;)Z

    move-result v0

    if-eqz v0, :cond_0

    invoke-virtual {p0, p1}, Lcom/kuguo/ad/KuguoAdsManager;->showSprite(Landroid/content/Context;)V

    goto :goto_0
.end method

.method protected static resetOnAppInstallListener()V
    .locals 1

    sget-object v0, Lcom/kuguo/ad/KuguoAdsManager;->listener:Ljava/util/Set;

    invoke-interface {v0}, Ljava/util/Set;->clear()V

    return-void
.end method


# virtual methods
.method public receivePushMessage(Landroid/content/Context;Z)V
    .locals 1

    if-eqz p2, :cond_0

    const/4 v0, 0x1

    :goto_0
    invoke-static {p1, v0}, Lcom/kuguo/ad/MainService;->a(Landroid/content/Context;I)V

    return-void

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public recycle(Landroid/content/Context;)V
    .locals 3

    const/4 v2, 0x0

    const-string v0, "android__log"

    const-string v1, "recycle !! "

    invoke-static {v0, v1}, Lcom/kuguo/c/a;->a(Ljava/lang/String;Ljava/lang/Object;)V

    iget-object v0, p0, Lcom/kuguo/ad/KuguoAdsManager;->mInstallPackageReceiver:Lcom/kuguo/ad/c;

    if-eqz v0, :cond_0

    :try_start_0
    invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    iget-object v1, p0, Lcom/kuguo/ad/KuguoAdsManager;->mInstallPackageReceiver:Lcom/kuguo/ad/c;

    invoke-virtual {v0, v1}, Landroid/content/Context;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V

    const-string v0, "android__log"

    const-string v1, "recycle with ------------- unregisterReceiver !!"

    invoke-static {v0, v1}, Lcom/kuguo/c/a;->a(Ljava/lang/String;Ljava/lang/Object;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :cond_0
    :goto_0
    const/4 v0, 0x1

    invoke-virtual {p0, p1, v0}, Lcom/kuguo/ad/KuguoAdsManager;->removeKuguoSprite(Landroid/content/Context;I)V

    invoke-virtual {p0, p1, v2}, Lcom/kuguo/ad/KuguoAdsManager;->removeKuguoSprite(Landroid/content/Context;I)V

    sput-boolean v2, Lcom/kuguo/ad/KuguoAdsManager;->hasRequest:Z

    const/4 v0, 0x0

    iput-object v0, p0, Lcom/kuguo/ad/KuguoAdsManager;->mInstallPackageReceiver:Lcom/kuguo/ad/c;

    iput-boolean v2, p0, Lcom/kuguo/ad/KuguoAdsManager;->showKuguoSide:Z

    iput-boolean v2, p0, Lcom/kuguo/ad/KuguoAdsManager;->showKuguoFree:Z

    return-void

    :catch_0
    move-exception v0

    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_0
.end method

.method public removeKuguoSprite(Landroid/content/Context;I)V
    .locals 2

    invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    const-string v1, "window"

    invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/view/WindowManager;

    if-nez p2, :cond_1

    :try_start_0
    iget-object v1, p0, Lcom/kuguo/ad/KuguoAdsManager;->kuguoSide:Lcom/kuguo/ad/s;

    if-eqz v1, :cond_0

    iget-object v1, p0, Lcom/kuguo/ad/KuguoAdsManager;->kuguoSide:Lcom/kuguo/ad/s;

    invoke-interface {v0, v1}, Landroid/view/WindowManager;->removeView(Landroid/view/View;)V

    :cond_0
    :goto_0
    return-void

    :cond_1
    const/4 v1, 0x1

    if-ne p2, v1, :cond_0

    iget-object v1, p0, Lcom/kuguo/ad/KuguoAdsManager;->kuguoFree:Lcom/kuguo/ad/s;

    if-eqz v1, :cond_0

    iget-object v1, p0, Lcom/kuguo/ad/KuguoAdsManager;->kuguoFree:Lcom/kuguo/ad/s;

    invoke-interface {v0, v1}, Landroid/view/WindowManager;->removeView(Landroid/view/View;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception v0

    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_0
.end method

.method public setCooId(Landroid/content/Context;Ljava/lang/String;)V
    .locals 0

    invoke-static {p1, p2}, Lcom/kuguo/ad/a;->f(Landroid/content/Context;Ljava/lang/String;)Z

    return-void
.end method

.method public showKuguoSprite(Landroid/content/Context;I)V
    .locals 3

    const/4 v1, 0x1

    invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    if-nez p2, :cond_2

    iput-boolean v1, p0, Lcom/kuguo/ad/KuguoAdsManager;->showKuguoSide:Z

    :goto_0
    sget-boolean v1, Lcom/kuguo/ad/KuguoAdsManager;->hasRequest:Z

    if-nez v1, :cond_3

    invoke-direct {p0, v0}, Lcom/kuguo/ad/KuguoAdsManager;->requestAppList(Landroid/content/Context;)V

    :cond_0
    :goto_1
    iget-object v0, p0, Lcom/kuguo/ad/KuguoAdsManager;->mInstallPackageReceiver:Lcom/kuguo/ad/c;

    if-nez v0, :cond_1

    new-instance v0, Lcom/kuguo/ad/c;

    invoke-direct {v0, p0}, Lcom/kuguo/ad/c;-><init>(Lcom/kuguo/ad/KuguoAdsManager;)V

    iput-object v0, p0, Lcom/kuguo/ad/KuguoAdsManager;->mInstallPackageReceiver:Lcom/kuguo/ad/c;

    new-instance v0, Landroid/content/IntentFilter;

    invoke-direct {v0}, Landroid/content/IntentFilter;-><init>()V

    const-string v1, "android.intent.action.PACKAGE_ADDED"

    invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    const-string v1, "package"

    invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addDataScheme(Ljava/lang/String;)V

    invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v1

    iget-object v2, p0, Lcom/kuguo/ad/KuguoAdsManager;->mInstallPackageReceiver:Lcom/kuguo/ad/c;

    invoke-virtual {v1, v2, v0}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

    const-string v0, "android__log"

    const-string v1, " ----------registerReceiver !! "

    invoke-static {v0, v1}, Lcom/kuguo/c/a;->a(Ljava/lang/String;Ljava/lang/Object;)V

    :cond_1
    return-void

    :cond_2
    iput-boolean v1, p0, Lcom/kuguo/ad/KuguoAdsManager;->showKuguoFree:Z

    goto :goto_0

    :cond_3
    invoke-static {v0}, Lcom/kuguo/ad/a;->r(Landroid/content/Context;)Z

    move-result v0

    if-eqz v0, :cond_0

    invoke-virtual {p0, p1}, Lcom/kuguo/ad/KuguoAdsManager;->showSprite(Landroid/content/Context;)V

    goto :goto_1
.end method

.method protected showSprite(Landroid/content/Context;)V
    .locals 2

    iget-object v0, p0, Lcom/kuguo/ad/KuguoAdsManager;->handler:Landroid/os/Handler;

    new-instance v1, Lcom/kuguo/ad/e;

    invoke-direct {v1, p0, p1}, Lcom/kuguo/ad/e;-><init>(Lcom/kuguo/ad/KuguoAdsManager;Landroid/content/Context;)V

    invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    return-void
.end method

.method public stopPushMessage(Landroid/content/Context;)V
    .locals 0

    invoke-static {p1}, Lcom/kuguo/ad/MainService;->a(Landroid/content/Context;)V

    return-void
.end method
